<?php

namespace app\api\model\user;

use app\common\model\user\Grade as GradeModel;

/**
 * 用户会员等级模型
 * Class Grade
 * @package app\api\model\user
 */
class Grade extends GradeModel
{
    public static function getGradeByUpgrade($money)
    {
        $grade = self::where('status', 1)->order('weight desc')->select();
        $data = [];
        foreach ($grade as $val) {
            if ($money >= $val['upgrade']['expend_money']) {
                $data = $val;
                break;
            }
        }
        return $data;
    }
}